package com.kuke.kukegateway.handler;

import com.kuke.kukecommon.entity.Result;
import com.kuke.kukecommon.handler.BaseExceptionHandler;
import com.kuke.kukegateway.exception.GatewayException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GatewayExceptionHandler extends BaseExceptionHandler {
    /**
     * 处理自定义异常
     * @param e
     * @return
     */
    @ExceptionHandler(GatewayException.class)
    public Result handleMyException(GatewayException e){
        return Result.error(e.getCode(), e.getMessage());
    }

}
